package util

import (
	"math/rand"
)

// ArrayRemove Remove
func ArrayRemove(slice []byte, index int) []byte {
	return append(slice[:index], slice[(index+1):]...)
}

// func reverse(s []byte) []byte {
// 	for i, j := 0, len(s)-1; i < j; i, j = i+1, j-1 {
// 		s[i], s[j] = s[j], s[i]
// 	}
// 	return s
// }

// ShuffleStringArray ShuffleStringArray
func ShuffleStringArray(arr []string) {
	if len(arr) <= 0 {
		return
	}

	rand.Seed(GetTimestamp())
	for i := len(arr) - 1; i >= 0; i-- {
		num := rand.Intn(len(arr))
		arr[i], arr[num] = arr[num], arr[i]
	}
}

// IsEmptyArrayBytes IsEmptyArrayBytes
func IsEmptyArrayBytes(arr []byte) bool {
	return len(arr) == 0
}
